<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="../../../component/layui/css/layui.css" media="all">
    <title>Title</title>
    <script src="../../../component/jquery3.6.0.js"></script>
    <style>
        .bottom {
            position: relative;
            left: 25%;
        }
    </style>
</head>
<body>
<form class="layui-form" id="layui-form-id" action="" lay-filter="deliver_edit_form">
    <div class="layui-form-item">
        <label class="layui-form-label"><strong>绩效编码</strong></label>
        <div class="layui-input-inline">
            <input id="saleperform_code" type="text" name="saleperform_code" lay-verify="title" autocomplete="off" placeholder="请输入计划编码" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"><strong>员工姓名</strong></label>
        <div class="layui-input-inline">
            <input id="emp_name" type="text" name="emp_name" placeholder="请输入姓名" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"><strong>所属部门</strong></label>
        <div class="layui-input-inline">
            <input id="dept_name" type="text" name="dept_name" lay-verify="title" autocomplete="off" placeholder="请输入月份" class="layui-input">
        </div>
    </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"><strong>绩效等级</strong></label>
        <div class="layui-input-inline">
            <input id="perform_level" type="text" name="perform_level" lay-verify="title" autocomplete="off" placeholder="请输入月份" class="layui-input">
        </div>
    </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label"><strong>备注信息</strong></label>
        <div class="layui-input-inline">
            <textarea id="des"  name="des" placeholder="请输入内容" class="layui-textarea"></textarea>
        </div>
    </div>
    <div class="bottom">
        <div class="button-container">
            <button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit="" lay-filter="user-save">
                <i class="layui-icon layui-icon-ok"></i>
                提交
            </button>
            <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">
                <i class="layui-icon layui-icon-refresh"></i>
                重置
            </button>
        </div>
    </div>
</form>

<script type="text/javascript" src="../../../component/layui/layui.js"></script>

<script>
    layui.use(['form'], function(){
        var form = layui.form;

        form.on('submit(user-save)', function(data){

            console.log(data.field);
            $.ajax({
                url:'http://localhost:8181/Manager_war/SgServlet/add',
                data:data.field,
                dataType:'json',
                // contentType:'application/json',form text  请求的格式 给后端是以json格式进行传输
                type:'post',
                success:function(result){
                    if(result.code==0){
                        layer.msg(result.msg,{icon:1,time:1000},function(){
                            parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
                            window.parent.location.reload(true);

                        });
                    }else{
                        layer.msg(result.msg,{icon:2,time:1000});
                    }
                }
            })
            return false;
        });


    });


</script>

</body>
</html>